import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/account_userInfo_entity.dart';

AccountUserInfoEntity $AccountUserInfoEntityFromJson(
    Map<String, dynamic> json) {
  final AccountUserInfoEntity accountUserInfoEntity = AccountUserInfoEntity();
  final String? userId = jsonConvert.convert<String>(json['userId']);
  if (userId != null) {
    accountUserInfoEntity.userId = userId;
  }
  final String? nickName = jsonConvert.convert<String>(json['nickName']);
  if (nickName != null) {
    accountUserInfoEntity.nickName = nickName;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    accountUserInfoEntity.avatar = avatar;
  }
  final double? userBalance = jsonConvert.convert<double>(json['userBalance']);
  if (userBalance != null) {
    accountUserInfoEntity.userBalance = userBalance;
  }
  final String? walletAddress = jsonConvert.convert<String>(
      json['walletAddress']);
  if (walletAddress != null) {
    accountUserInfoEntity.walletAddress = walletAddress;
  }
  final String? guildName = jsonConvert.convert<String>(json['guildName']);
  if (guildName != null) {
    accountUserInfoEntity.guildName = guildName;
  }
  final String? guildId = jsonConvert.convert<String>(json['guildId']);
  if (guildId != null) {
    accountUserInfoEntity.guildId = guildId;
  }
  final int? guildMemberLevel = jsonConvert.convert<int>(
      json['guildMemberLevel']);
  if (guildMemberLevel != null) {
    accountUserInfoEntity.guildMemberLevel = guildMemberLevel;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    accountUserInfoEntity.email = email;
  }
  final AccountUserInfoWithdrawSet? withdrawSet = jsonConvert.convert<
      AccountUserInfoWithdrawSet>(json['withdrawSet']);
  if (withdrawSet != null) {
    accountUserInfoEntity.withdrawSet = withdrawSet;
  }
  final int? stoneNum = jsonConvert.convert<int>(json['stoneNum']);
  if (stoneNum != null) {
    accountUserInfoEntity.stoneNum = stoneNum;
  }
  final double? rechargeMinDrn = jsonConvert.convert<double>(
      json['rechargeMinDrn']);
  if (rechargeMinDrn != null) {
    accountUserInfoEntity.rechargeMinDrn = rechargeMinDrn;
  }
  final int? rechargeMinCoin = jsonConvert.convert<int>(
      json['rechargeMinCoin']);
  if (rechargeMinCoin != null) {
    accountUserInfoEntity.rechargeMinCoin = rechargeMinCoin;
  }
  final int? rechargeUsdtCoin = jsonConvert.convert<int>(
      json['rechargeUsdtCoin']);
  if (rechargeUsdtCoin != null) {
    accountUserInfoEntity.rechargeUsdtCoin = rechargeUsdtCoin;
  }
  final int? coin = jsonConvert.convert<int>(json['coin']);
  if (coin != null) {
    accountUserInfoEntity.coin = coin;
  }
  final int? newGift = jsonConvert.convert<int>(json['newGift']);
  if (newGift != null) {
    accountUserInfoEntity.newGift = newGift;
  }
  final double? utn = jsonConvert.convert<double>(json['utn']);
  if (utn != null) {
    accountUserInfoEntity.utn = utn;
  }
  return accountUserInfoEntity;
}

Map<String, dynamic> $AccountUserInfoEntityToJson(
    AccountUserInfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['userId'] = entity.userId;
  data['nickName'] = entity.nickName;
  data['avatar'] = entity.avatar;
  data['userBalance'] = entity.userBalance;
  data['walletAddress'] = entity.walletAddress;
  data['guildName'] = entity.guildName;
  data['guildId'] = entity.guildId;
  data['guildMemberLevel'] = entity.guildMemberLevel;
  data['email'] = entity.email;
  data['withdrawSet'] = entity.withdrawSet?.toJson();
  data['stoneNum'] = entity.stoneNum;
  data['rechargeMinDrn'] = entity.rechargeMinDrn;
  data['rechargeMinCoin'] = entity.rechargeMinCoin;
  data['rechargeUsdtCoin'] = entity.rechargeUsdtCoin;
  data['coin'] = entity.coin;
  data['newGift'] = entity.newGift;
  data['utn'] = entity.utn;
  return data;
}

extension AccountUserInfoEntityExt on AccountUserInfoEntity {
  AccountUserInfoEntity copyWith({
    String? userId,
    String? nickName,
    String? avatar,
    double? userBalance,
    String? walletAddress,
    String? guildName,
    String? guildId,
    int? guildMemberLevel,
    String? email,
    AccountUserInfoWithdrawSet? withdrawSet,
    int? stoneNum,
    double? rechargeMinDrn,
    int? rechargeMinCoin,
    int? rechargeUsdtCoin,
    int? coin,
    int? newGift,
    double? utn,
  }) {
    return AccountUserInfoEntity()
      ..userId = userId ?? this.userId
      ..nickName = nickName ?? this.nickName
      ..avatar = avatar ?? this.avatar
      ..userBalance = userBalance ?? this.userBalance
      ..walletAddress = walletAddress ?? this.walletAddress
      ..guildName = guildName ?? this.guildName
      ..guildId = guildId ?? this.guildId
      ..guildMemberLevel = guildMemberLevel ?? this.guildMemberLevel
      ..email = email ?? this.email
      ..withdrawSet = withdrawSet ?? this.withdrawSet
      ..stoneNum = stoneNum ?? this.stoneNum
      ..rechargeMinDrn = rechargeMinDrn ?? this.rechargeMinDrn
      ..rechargeMinCoin = rechargeMinCoin ?? this.rechargeMinCoin
      ..rechargeUsdtCoin = rechargeUsdtCoin ?? this.rechargeUsdtCoin
      ..coin = coin ?? this.coin
      ..newGift = newGift ?? this.newGift
      ..utn = utn ?? this.utn;
  }
}

AccountUserInfoWithdrawSet $AccountUserInfoWithdrawSetFromJson(
    Map<String, dynamic> json) {
  final AccountUserInfoWithdrawSet accountUserInfoWithdrawSet = AccountUserInfoWithdrawSet();
  final int? dayMaxCount = jsonConvert.convert<int>(json['dayMaxCount']);
  if (dayMaxCount != null) {
    accountUserInfoWithdrawSet.dayMaxCount = dayMaxCount;
  }
  final double? minDrn = jsonConvert.convert<double>(json['minDrn']);
  if (minDrn != null) {
    accountUserInfoWithdrawSet.minDrn = minDrn;
  }
  final int? maxDrn = jsonConvert.convert<int>(json['maxDrn']);
  if (maxDrn != null) {
    accountUserInfoWithdrawSet.maxDrn = maxDrn;
  }
  final double? feeRate = jsonConvert.convert<double>(json['feeRate']);
  if (feeRate != null) {
    accountUserInfoWithdrawSet.feeRate = feeRate;
  }
  final int? everyDoranCoin = jsonConvert.convert<int>(json['everyDoranCoin']);
  if (everyDoranCoin != null) {
    accountUserInfoWithdrawSet.everyDoranCoin = everyDoranCoin;
  }
  final int? withdrawMinCoin = jsonConvert.convert<int>(
      json['withdrawMinCoin']);
  if (withdrawMinCoin != null) {
    accountUserInfoWithdrawSet.withdrawMinCoin = withdrawMinCoin;
  }
  final int? dayLimit = jsonConvert.convert<int>(json['dayLimit']);
  if (dayLimit != null) {
    accountUserInfoWithdrawSet.dayLimit = dayLimit;
  }
  return accountUserInfoWithdrawSet;
}

Map<String, dynamic> $AccountUserInfoWithdrawSetToJson(
    AccountUserInfoWithdrawSet entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['dayMaxCount'] = entity.dayMaxCount;
  data['minDrn'] = entity.minDrn;
  data['maxDrn'] = entity.maxDrn;
  data['feeRate'] = entity.feeRate;
  data['everyDoranCoin'] = entity.everyDoranCoin;
  data['withdrawMinCoin'] = entity.withdrawMinCoin;
  data['dayLimit'] = entity.dayLimit;
  return data;
}

extension AccountUserInfoWithdrawSetExt on AccountUserInfoWithdrawSet {
  AccountUserInfoWithdrawSet copyWith({
    int? dayMaxCount,
    double? minDrn,
    int? maxDrn,
    double? feeRate,
    int? everyDoranCoin,
    int? withdrawMinCoin,
    int? dayLimit,
  }) {
    return AccountUserInfoWithdrawSet()
      ..dayMaxCount = dayMaxCount ?? this.dayMaxCount
      ..minDrn = minDrn ?? this.minDrn
      ..maxDrn = maxDrn ?? this.maxDrn
      ..feeRate = feeRate ?? this.feeRate
      ..everyDoranCoin = everyDoranCoin ?? this.everyDoranCoin
      ..withdrawMinCoin = withdrawMinCoin ?? this.withdrawMinCoin
      ..dayLimit = dayLimit ?? this.dayLimit;
  }
}